import java.util.Arrays;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 故我
 * Date: 2023-04-15
 * Time: 10:32
 */

public class Test {
    public static void reverse(int[] array1, int[] array2) {
        //选长度小的数组
        int len1 = array1.length;
        int len2 = array2.length;
        int length = len1 < len2 ? len1 : len2;
        for (int i = 0; i < length; i++) {
            int tmp = array1[i];
            array1[i] = array2[i];
            array2[i] = tmp;
        }
    }

    public static void main(String[] args) {
        // 给定两个整型数组, 交换两个数组的内容.
        int[] array1 = {1, 2, 3, 4, 5};
        int[] array2 = {6, 7, 8, 9};
        System.out.println(Arrays.toString(array1));
        System.out.println(Arrays.toString(array2));
        System.out.println("====================");
        reverse(array1, array2);
        System.out.println(Arrays.toString(array1));
        System.out.println(Arrays.toString(array2));

    }

    public static void func(int[] array) {
        int left = 0;
        int right = array.length - 1;
        while (left < right) {
            while (left < right && array[left] % 2 == 0) {
                left++;
            }
            while (left < right && array[right] % 2 != 0) {
                right--;
            }

            int tmp = array[left];
            array[left] = array[right];
            array[right] = tmp;

            left++;
            right--;
        }
    }

    public static void main2(String[] args) {
        // 给定整型数组, 把所有的偶数放到数组前面, 把所有奇数放到数组后面.
        int[] arr = new int[]{1, 2, 3, 4, 5, 6, 7, 9, 8, 10};
        func(arr);
        System.out.println(Arrays.toString(arr));
    }
}

//public class Test{
//    static boolean flag;
//    public static void main(String[] args) {
//        System.out.println(flag);
//    }
//}

//public class Test {
//    public int aMethod(){
//        static int i = 0;
//        i++;
//        return i;
//    }
//    public static void main(String args[]){
//        Test test = new Test();
//        test.aMethod();
//        int j = test.aMethod();
//        System.out.println(j);
//    }
//}

//public class TestDamo{
//    public int TestMeothd{
//        static int i=0;
//        i++;
//        return i;
//    }
//
//    public static void main(String[] args) {
//
//    }
//}
//public class Test {
//    public static void main(String[] args) {
//
//    }
//}

class Hello {
    public static void Hello() {
        System.out.println("Hello");
    }
}

class Test1 {
    public static void main1(String[] args) {
        Hello hello = new Hello();
        hello.Hello();
    }

}

class Person {
    private String name = "tc";
    int age;
}

//public class Test extends Person{
  /*  private float flag = 1.0f;
    int m=10;
    static int n =20;
    public static void main(String[] args) {
        Test t = new Test();
        //t.flag = 3.0;// x
        //this.n;//x
        //Test.m = 20;
        //Test.n = 10;
    }*/

    /*public String garde;

    public static void main(String[] args) {
        Person p = new Test();
        System.out.println(p.name);
    }*/
//}

/*public class Test {
    private static int m = 100;

    public static void main(String[] args) {
        Test t1 = new Test();
        t1.m++;
        Test t2 = new Test();
        t2.m++;
        t1 = new Test();
        t1.m++;
        Test.m--;
        System.out.println("m = " + m);
    }
}*/

/*public class Test {
 *//* private int m;
    public static void main(String[] args) {
        Test t = new Test(88);
        System.out.println(t.m);
    }
    Test(int m){
        m=m;
    }*//*

 *//*  static int m = 6;

      static {
          m += 9;
      }

      public static void main(String[] args) {
          System.out.println("m = " + m);
      }

      static {
          m /= 3;
      }*//*
    public String toString() {
        System.out.print("aaa");
        return "bbb";
    }

    public static void main(String[] args) {
        Test test = new Test();
        System.out.println(test);
    }
}*/























